Write on the margins of the internet. Powered by the AT Protocol. margin.at
extension web atproto comments
at main 31 lines 745 B view raw
1--- 2export const prerender = false; 3 4import OGLayout from '../../../layouts/OGLayout.astro'; 5import { resolveHandle, fetchCollectionOG } from '../../../lib/og'; 6 7const { handle, rkey } = Astro.params; 8 9let title = 'Margin'; 10let description = 'Annotate the web'; 11let image = 'https://margin.at/og.png'; 12 13if (handle && rkey) { 14 try { 15 const did = await resolveHandle(handle); 16 if (did) { 17 const uri = `at://${did}/at.margin.collection/${rkey}`; 18 const data = await fetchCollectionOG(uri); 19 if (data) { 20 title = data.title; 21 description = data.description; 22 image = data.image; 23 } 24 } 25 } catch (e) { 26 console.error('OG fetch error (collection):', e); 27 } 28} 29--- 30 31<OGLayout title={title} description={description} image={image} />